// import request from 'umi-request';
import request from '@/utils/request';
export async function queryRule(params) {
  const limit = params.pageSize;
  const page = params.current;
  const my_params = {
    limit: limit,
    page: page,
  };
  Object.assign(params, my_params);
  delete params.current;
  delete params.pageSize;
  return request('employee/page', {
    params,
  });
}
export async function queryDepartment(params) {
  return request('/dept/list', {
    params,
  });
}
export async function queryPosition(params) {
  return request(`/position/list`, {
    params,
  });
}
export async function queryPositionMessage(params) {
  return request(`/position/${params}`);
}
export async function queryGetStore(params) {
  return request(`/position/${params}`);
}
export async function queryRole(params) {
  return request('/role/list', {
    params,
  });
}
export async function queryStore(params) {
  return request('store/store/list', {
    params,
  });
}
export async function queryCommission(params) {
  return request('employee/commission/list', {
    params,
  });
}

export async function searchStaff(params) {
  return request(`/employee/${params}`);
}
export async function queryRoleRule() {
  const params = {
    limit: 1000,
    page: 1,
  };
  return request('employee/page', {
    params,
  });
}
export async function removeRule(params) {
  return request(`/employee/${params.id}`, {
    method: 'DELETE',
  });
}
export async function addRule(params) {
  return request('/factory/system/sysUser', {
    method: 'POST',
    data: {
      ...params,
    },
  });
}

export async function editRule(params) {
  return request('/employee', {
    method: 'PUT',
    data: {
      ...params,
    },
  });
}
export async function enableRule(params) {
  return request(`/factory/system/sysUser/${params.id}/enable?version=${params.version}`, {
    method: 'PUT',
  });
}
export async function disabledRule(params) {
  return request(`/factory/system/sysUser/${params.id}/disabled?version=${params.version}`, {
    method: 'PUT',
  });
}
export async function resetPassWordRule(params) {
  return request(`/factory/system/sysUser/password/reset/${params.id}?version=${params.version}`, {
    method: 'PUT',
  });
}
export async function addStaff(params) {
  return request('/employee', {
    method: 'POST',
    data: {
      ...params,
    },
  });
}
